import request from '@/utils/request'

export function Get(id, args) {
  return request({
    url: `/cms/api/topic/${id || ''}${args && ('?' + args) || ''}`,
    method: 'get'
  })
}

export function Post(data) {
  return request({
    url: '/cms/api/topic/',
    headers: { 'content-type': 'application/json' },
    method: 'post',
    data: data
  })
}

export function Put(id, data) {
  return request({
    url: `/cms/api/topic/${id || ''}`,
    headers: { 'content-type': 'application/json' },
    method: 'put',
    data: data
  })
}

export function Delete(id) {
  return request({
    url: `/cms/api/topic/${id || ''}`,
    method: 'delete'
  })
}

export function Tree(id, args) {
  return request({
    url: `/cms/api/topic_tree/${id || ''}${args && ('?' + args) || ''}`,
    method: 'get',
    timeout: 1000000
  })
}

export function GetHistory(id, args) {
  return request({
    url: `/cms/api/topic/${id || ''}${args && ('?' + args) || ''}`,
    method: 'get'
  })
}

export function dt(data) {
  return request({
    url: '/cms/api/topic/dt/',
    headers: { 'content-type': 'application/json' },
    method: 'post',
    data: data
  })
}

export function topic_crawl_amazon_toggle(id, args) {
  return request({
    url: `/cms/api/topic_crawl_amazon_toggle/${id || ''}${args && ('?' + args) || ''}`,
    method: 'get'
  })
}

export function topic_childrens_modify(data) {
  return request({
    url: '/cms/api/children_modify/',
    headers: { 'content-type': 'application/json' },
    method: 'post',
    data: data
  })
}

export function BatchUpdateReviewState(data) {
  return request({
    url: '/cms/api/topic_batch_review/',
    headers: { 'content-type': 'application/json' },
    method: 'post',
    data: data
  })
}

export function GetArticleList(id, args) {
  return request({
    url: `/cms/api/topic_article_list/${id || ''}${args && ('?' + args) || ''}`,
    method: 'get'
  })
}
